home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3c / mktemp.z / mktemp
Encoding:
Text File  |  2002-10-03  |  2.8 KB  |  67 lines

  1.  
  2.  
  3.  
  4. MMMMKKKKTTTTEEEEMMMMPPPP((((3333CCCC))))                                                          MMMMKKKKTTTTEEEEMMMMPPPP((((3333CCCC))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      mktemp, mkstemp - make a unique file name
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ####iiiinnnncccclllluuuuddddeeee <<<<ssssttttddddiiiioooo....hhhh>>>>
  13.  
  14.      cccchhhhaaaarrrr ****mmmmkkkktttteeeemmmmpppp ((((cccchhhhaaaarrrr ****tttteeeemmmmppppllllaaaatttteeee))));;;;
  15.  
  16.      iiiinnnntttt mmmmkkkksssstttteeeemmmmpppp((((cccchhhhaaaarrrr ****tttteeeemmmmppppllllaaaatttteeee))));;;;
  17.  
  18. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  19.      _M_k_t_e_m_p replaces the contents of the string pointed to by _t_e_m_p_l_a_t_e by a
  20.      unique file name, and returns the address of _t_e_m_p_l_a_t_e.  The string in
  21.      _t_e_m_p_l_a_t_e should look like a file name with six trailing XXXXs; _m_k_t_e_m_p will
  22.      replace the XXXXs with a string that can be used to create a unique file
  23.      name.
  24.  
  25.      _M_k_s_t_e_m_p makes the same replacement to the template but returns a file
  26.      descriptor for the template file open for reading and writing.  _M_k_s_t_e_m_p
  27.      avoids the race between testing whether the file exists and opening it
  28.      for use.
  29.  
  30.      The _m_k_s_t_e_m_p routine is from the 4.3BSD standard C library.
  31.  
  32. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  33.      getpid(2), tmpfile(3S), tmpnam(3S).
  34.  
  35. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  36.      _M_k_t_e_m_p will assign a zero to the first character of _t_e_m_p_l_a_t_e if it cannot
  37.      create a unique name, returning the empty string.
  38.  
  39.      _M_k_s_t_e_m_p returns an open file descriptor upon success.  It returns -1 if
  40.      no suitable file could be created.
  41.  
  42. CCCCAAAAVVVVEEEEAAAATTTT
  43.      _M_k_t_e_m_p makes 26 attempts to generate a filename which is not currently in
  44.      use from a given _t_e_m_p_l_a_t_e.  Since the filename generated uses the process
  45.      ID as a base, it is highly unlikely that these names will conflict with
  46.      those generated by another process.  Variation in the contents of the
  47.      actual string given to _m_k_t_e_m_p, as well as the number of times _m_k_t_e_m_p is
  48.      called, will determine the likelihood of successfully generating a unique
  49.      name.
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.